package com.chen.qq;

import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;

import com.chen.gui.component.button.BaseButton;
import com.chen.gui.component.button.CButton;
import com.chen.gui.layout.TableLayout;

public class BottomPane extends JPanel {

	private static final long serialVersionUID = 748956740059279580L;

	private BaseButton btnQQ = BaseButton.createShapeButton(BaseButton.Round);

	private CButton btnZone = Context.getButton("zone.png");

	private CButton btnVideo = Context.getButton("video.png");

	private CButton btnMusic = Context.getButton("music.png");

	private CButton btnAppMan = Context.getButton("appman.png");

	private CButton btnConfig = Context.getButton("setting2.png");

	private CButton btnVolume = Context.getButton("volume.png");

	private CButton btnSecurity = Context.getButton("security.png");

	private CButton btnScope = Context.getButton("scope.png");

	private CButton btnSearch = Context.getButton("search2.png");

	public BottomPane() {
		this.setLayout(new BorderLayout());
		this.add(btnQQ, BorderLayout.WEST);
		btnQQ.setIcon(Context.getIcon("qq.png"));
		btnQQ.setRolloverIcon(Context.getIcon("qqon.png"));
		this.add(getCenterPane());
	}

	private JComponent getCenterPane() {
		double[][] para = { { TableLayout.FILL, TableLayout.PREFERRED }, { TableLayout.PREFERRED } };
		JPanel topPane = Context.getTablePane(para);
		JPanel leftPane = Context.getFlowPane();
		leftPane.add(btnZone);
		leftPane.add(btnVideo);
		leftPane.add(btnMusic);

		topPane.add(leftPane, "0,0,f,f");
		topPane.add(btnAppMan, "1,0,f,f");

		JPanel bottomPane = Context.getFlowPane();
		bottomPane.add(btnConfig);
		bottomPane.add(btnVolume);
		bottomPane.add(btnSecurity);
		bottomPane.add(btnScope);
		bottomPane.add(btnSearch);

		para = new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED } };
		JPanel rootPane = Context.getTablePane(para);
		rootPane.add(topPane, "0,0,f,f");
		rootPane.add(bottomPane, "0,1,f,f");

		rootPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
		return rootPane;
	}
}
